package SCHLUMBERGER;

import java.util.LinkedList;

/**
 * Created by Ghost on 2014/12/24 0024.
 */
public class Integer_Devide {
    LinkedList<Integer> rst = new LinkedList<Integer>();
    int r = 0;

    private void de(int n, int left) {
        if(left==0){
            r++;
            System.out.println(rst);
        }
        else{
            for(int i=0;i<n;i++){
                rst.addLast(n-i);
                if(n-i<left){
                    de(n-i,left-n+i);
                }
                else{
                    de(i,left-n+i);
                }
                rst.removeLast();
            }
        }
    }

    public int devide(int n) {
        for(int i=0;i<n;i++){
            rst.addLast(n-i);
            if(i>n-i){
                de(n-i,i);
            }
            else{
                de(i,i);
            }
            rst.removeLast();
        }

        System.out.println(r);
        return r;
    }

    public static void main(String[] args){
        Integer_Devide integer_devide= new Integer_Devide();
        integer_devide.devide(3);
    }
}
